package com.cn.server;

import com.cn.server.tcp.Server;
import com.cn.server.websocket.WebSocketServer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 启动函数
 *
 * @author admin
 */
public class ServerMain {

    @SuppressWarnings("resource")
    public static void main(String[] args) {
        try {
            ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");

//		Server server = applicationContext.getBean(Server.class);
            WebSocketServer webSocketServer = applicationContext.getBean(WebSocketServer.class);
            webSocketServer.registerHandlers().start();
            Server server = applicationContext.getBean(Server.class);
            server.registerHandlers().start();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
